<template>
	<view class="user_money_index">
		<view class="money_show">
			<view>总余额（CN）</view>
			<view class="money_font"><view class="item" @click="$nav('/pages/user/cash/form')">提现 <uni-icons style="margin-left: 15rpx;" type="arrowright" color="#fff" size="14"></uni-icons></view>￥{{user_info.money||'0.00'}}</view>
			<view>冻结资金：{{user_info.frozen_money||'0.00'}}</view>
		</view>
		
		<!-- 列表 -->
		<view class="money_list">
			<uni-list :border="false">
				<uni-list-item @click="$nav('/pagesUser/money/list?is_type=0')" clickable title="收支记录" :showArrow="true"></uni-list-item>
				<uni-list-item @click="$nav('/pagesUser/money/list?is_type=1')" clickable title="冻结记录" :showArrow="true"></uni-list-item>
				<uni-list-item @click="$nav('/pagesUser/money/list?is_type=2')" clickable title="积分记录" :showArrow="true"></uni-list-item>
				<uni-list-item @click="$nav('/pages/user/cash/index')" clickable title="提现记录" :showArrow="true"></uni-list-item>
				<uni-list-item @click="userCheck()" clickable title="身份认证" :rightText="user_info.user_check?'已认证':'未认证'" :showArrow="true"></uni-list-item>
				<uni-list-item @click="$nav('/pagesUser/money/edit_pay_password')" clickable title="修改支付密码" :showArrow="true"></uni-list-item>
			</uni-list>
		</view>
		
		<!-- 修改密码 -->
		<put-password :text="text" ref="put_password" @password="check"></put-password>
	</view>
</template>

<script>
	import putPassword from '@/components/put_password';
	export default {
		components:{
			putPassword
		},
		data() {
			return {
				user_info:{},
				text:'旧支付密码，默认1-6',
				isSetPassword:false,
			};
		},
		onLoad() {
			uni.$on('users',()=>{
				this.checkLogin();
			})
			this.checkLogin();
		},
		methods:{
			put_password(){
				this.$refs.put_password.masks();
			},
			check(){
				
			},
			checkLogin(){
				let obj = {...this.$api.users}
				obj.url += '/info'
				this.$http(obj).then(res=>{
					if(res.code == 200){
						this.user_info = res.data
					}
				})
			},
			userCheck(){
				if(this.user_info.user_check){
					this.$nav('/pages/user/user_check/checked')
				}else{
					this.$nav('/pages/user/user_check/check')
				}
			}
		}
	}
</script>

<style lang="scss">
.money_list{
	background-color: #fff;
	border-radius: 10upx;
	margin: 30upx;
}
.money_show{
	background-color: $uni-color-error;
	margin: 30upx 30upx 0 30upx;
	border-radius:10upx ;
	color:#fff;
	font-size: 28upx;
	padding: 30upx;
	.money_font{
		font-size: 60upx;
		margin-top: 40upx;
		margin-bottom: 40upx;
		line-height: 60upx;
		.item{
			line-height: 60upx;
			font-size: 28upx;
			float: right;
			.money_more{
				margin-left: 10upx;
			}
		}
	}
}
</style>
